package com.cwd.arm.infrastructure.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cwd.arm.infrastructure.dao.MonthAmountTotalDao;
import com.cwd.arm.infrastructure.dao.base.DaoImpl;
import com.cwd.arm.infrastructure.mapper.MonthAmountTotalMapper;
import com.cwd.arm.infrastructure.po.MonthAmountTotalPo;
import com.cwd.arm.infrastructure.po.YearAmountPo;
import com.cwd.arm.infrastructure.query.MonthAmountTotalDaoQuery;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* Description:每月金额统计
* Created on 2021年11月16日
* @author  yan
*/
@Service
public class MonthAmountTotalDaoImpl extends DaoImpl<MonthAmountTotalMapper, MonthAmountTotalPo> implements MonthAmountTotalDao {

    @Override
    public List<MonthAmountTotalPo> selectQuery(MonthAmountTotalDaoQuery daoQuery) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(ObjectUtils.isNotEmpty(daoQuery.getYear()),"fy_year",daoQuery.getYear());
        queryWrapper.eq(ObjectUtils.isNotEmpty(daoQuery.getMonth()),"fy_month",daoQuery.getMonth());
        return list(queryWrapper);
    }

    @Override
    public MonthAmountTotalPo selectOne(int year, int month) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("fy_year",year);
        queryWrapper.eq("fy_month",month);
        return getOne(queryWrapper);
    }

    @Override
    public List<YearAmountPo> selectYearConfirmIncome() {
        return baseMapper.selectYearConfirmIncome();
    }
}
